package com.example.chat.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.chat.pojo.bo.Friend;
import com.example.chat.pojo.vo.UserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface FriendMapper extends BaseMapper<Friend> {
    List<UserVO> listByCid(String cid);

    @Update("update tb_friend set state = 2 where user_id = #{userId} and friend_id = #{friendId}")
    Integer addStarFriend(String userId, String friendId);

    @Update("update tb_friend set state = 0 where user_id = #{userId} and friend_id = #{friendId}")
    Integer cancelStarFriend(String userId, String friendId);

    List<UserVO> chatListByCid(String cid);

    UserVO getChatById(Integer id);
}
